<template>
    <!-- 输入框 -->
    <van-dialog v-model="show" :title="title" show-cancel-button :lazy-render="false" @confirm="handleConfirm"
        @cancel="handleCancel">
        <van-field type="textarea" v-model="message" rows="2" autosize autofocus maxlength="999"
            :placeholder="'请输入' + title" show-word-limit class="message" />
    </van-dialog>
</template>

<script>
export default {
    props: {
        show: {
            type: Boolean,
            default: () => {
                return false;
            },
        },
        title: {
            type: String,
            default: () => {
                return '';

            },
        },
    },
    data () {
        return {
            // show: false,
            message: ''
        };
    },
    methods: {
        handleConfirm () {
            // 在确认按钮点击时执行的方法回调
            console.log('确认按钮被点击');
            // 执行其他逻辑操作
            this.$emit('handleConfirm', this.message, this.title)
            this.message = ''
        },
        // 取消的方法
        handleCancel () {
            this.$emit('handleCancel')
        },

    },
};
</script>

<style lang="scss" scoped>
.message {
    .van-field {
        border: 1px solid #e2e2e2;
        width: 90%;
        margin: 12px auto 28px auto;
        background: #f6f6f6;
    }
}
</style>
